<?php
namespace TestAdmin\Controller;
use Think\Controller;

use Common\Controller\CommonActions\OrgnizerActionController as OrgC;
class UserListController extends BaseController {


    public function getUserList()
    {
        $data = M("users")->select();
        $this->ajaxReturn($data);
    }


    /**
     * 更新用户信息
     */
    public function updateUserInfo()
    {
        $uid = I("uid");
        $data['username'] = I('username');
        $data['email'] = I('useremail');
        $data['password'] = I('userpassword');

        $this->ajaxReturn(OrgC::updateUserinfo($uid, $data));
    }


     public function addUsers()
    {
        $userjsondata = I_withoutReplace("jsondata");
        $userlist = json_decode($userjsondata, true);
        $this->ajaxReturn(D('Common/Users')->addUsers($userlist[0])) ;
    }

    public function deleteUsers(){
        $userlist = I("userlist");
        $userlist = str_replace("&quot;", "\"",$userlist);
        $userlist = json_decode($userlist, true);

        $this->ajaxReturn(D("Users")->deleteUsers($userlist));

//        foreach($userlist as $user){
//            foreach($user as $u){
//                $User->relation(true)->delete($u['uid']);
//            }
//        }
//
//        $rs['msg'] = 1;
//        $this->ajaxReturn($rs);
    }


}